//
//  XSJWholeCollectionCell.m
//  XSJ
//
//  Created by yuanyuan he on 2020/5/8.
//  Copyright © 2020 apple. All rights reserved.
//

#import "XSJWholeCollectionCell.h"
#import "UIImageView+WebCache.h"

@interface XSJWholeCollectionCell()

@property (nonatomic, strong) UIImageView* iconView;
@property (nonatomic, strong) UILabel* nameLabel;
@property (nonatomic, strong) UIImageView* smallView;
@property (nonatomic, strong) UILabel* numberLabel;

@end

@implementation XSJWholeCollectionCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self setup];
    }
    return self;
}

- (void)setup
{
    self.contentView.backgroundColor = ColorHex(0xffffff);
    
    [self.contentView addSubview:self.iconView];
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.smallView];
    [self.contentView addSubview:self.numberLabel];
    
    [_iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(8);
        make.top.mas_equalTo(5);
        make.width.height.mas_equalTo(173);
    }];
    
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self->_iconView.mas_left).offset(5);
        make.bottom.equalTo(self->_iconView.mas_bottom).offset(-5);
    }];
    
    [_smallView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self->_iconView.mas_left).offset(113);
        make.bottom.equalTo(self->_iconView.mas_bottom).offset(-5);
    }];
    
    [_numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self->_smallView.mas_right).offset(2);
        make.centerY.equalTo(self->_smallView);
    }];
   
}

//-(void)setModel:(HotHouseModel *)model
//{
//    _model = model;
//
//    //显示头像
//    if (!kStringIsEmpty(_model.picture))
//    {
//        [_iconView sd_setImageWithURL:[NSURL URLWithString:model.picture]];
//    }
//    _nameLabel.text = _model.name;
//}
//
//-(void)setMyRoomModel:(YCHMyRoomModel *)myRoomModel
//{
//    _myRoomModel = myRoomModel;
//    //显示头像
//    if (!kStringIsEmpty(_myRoomModel.picture))
//    {
//        [_iconView sd_setImageWithURL:[NSURL URLWithString:myRoomModel.picture]];
//    }
//    _nameLabel.text = _myRoomModel.name;
//}

- (UIImageView *)iconView {
    if (_iconView == nil) {
        _iconView = [[UIImageView alloc] init];
        _iconView.image = [UIImage imageNamed:@"man2"];
        _iconView.clipsToBounds = YES;
        _iconView.layer.cornerRadius = 5.0f;
    }
    return _iconView;
}

- (UILabel *)nameLabel {
    if (_nameLabel == nil) {
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.textColor = ColorHex(0xFFFFFF);
        _nameLabel.font = [UIFont systemFontOfSize:14];
        _nameLabel.text = @"主播昵称";
        _nameLabel.numberOfLines = 0;
    }
    return _nameLabel;
}

- (UIImageView *)smallView {
    if (_smallView == nil) {
        _smallView = [[UIImageView alloc] init];
        _smallView.image = [UIImage imageNamed:@"views"];
    }
    return _smallView;
}

- (UILabel *)numberLabel {
    if (_numberLabel == nil) {
        _numberLabel = [[UILabel alloc] init];
        _numberLabel.textColor = ColorHex(0xFFFFFF);
        _numberLabel.font = [UIFont systemFontOfSize:11];
        _numberLabel.text = @"9.9万";
    }
    return _numberLabel;
}


@end
